package com.leetcode.week.week291;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author angzhijin
 * @Description
 * @create 2022-05-01 11:13 上午
 */
public class LeetCodeWeek3 {

     static Set<List<Integer>> set = new HashSet<>();

    public static void main(String[] args) {
        System.out.println(countDistinct(new int[]{2,3,3,2,2},2,2));
    }

    public static int countDistinct(int[] nums, int k, int p) {

        for (int i = 0; i < nums.length; i++) {
            List<Integer> list = new ArrayList<>();
            int count =0;
            for (int j = i; j < nums.length; j++) {
                list.add(nums[j]);
                //System.out.print(list);
                if(nums[j]%p==0) count++;
                if(count>k) break;
                //System.out.println("-1");
                set.add(new ArrayList<>(list));
            }
        }
//        for (List<Integer> item: set){
//            System.out.println(item);
//        }
        return set.size();
    }
}
